import matplotlib
matplotlib.use('TkAgg')  # 切换到兼容性更好的后端
import matplotlib.pyplot as plt

# 设置中文字体和支持负号显示
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

def plot_data():
    x = [1, 2, 3, 4, 5]
    y = [10, 20, 25, 30, 40]
    plt.plot(x, y)
    plt.xlabel('X轴')
    plt.ylabel('Y轴')
    plt.title('简单折线图')
    plt.show()

plot_data()
